<!DOCTYPE html>
<!-- saved from url=(0037)http://127.0.0.1/wx/ybss/zhuce/zc.jsp -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <title>店铺信息</title>

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no, email=no">
  <!--[if IE]>
  <script src="http://127.0.0.1:80/wx/ybss/js/html5shiv.min.js"></script>
  <![endif]-->


  <script type="text/javascript" src="../../script/constants.js"></script>
  <script src="../resource/md5.js"></script>
  <script src="../resource/jquery214.js"></script>
  <script src="../resource/fastclick.js"></script>
  <script src="../resource/jqueryweui.js"></script>
  </script><script src="../resource/picker.js"></script>
  <script src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/aes.js"></script>
  <script type="text/javascript" src="../../script/optionData.js"></script>
  <script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
  <script type="text/javascript" src="../../script/modeecb.js"></script>
  <script src="../../script/tmd5.js"></script>
  <script>


  </script>

  <style>

   .odiv{
	   display:table;
	   background:#fff;
	   width:100%;
	   padding:5px;
	   border-top:1px solid #E1E1E1; 
	   border-bottom:1px solid #E1E1E1;
   }
   .idiv{
	   float: left;
	   font-size:15px;
	   margin-left: 10px;
	   height:40px;
	   line-height:40px;
   }
   .div_text{
	   float: right;
	   height:40px;
	   line-height:40px;
	   width:65%;
	   color: #8d8d8d;
	   font-size:15px;
	   text-align: right;
	   overflow:hidden;
	   white-space: nowrap; 
	   text-overflow: ellipsis;
	   margin-right:10px;
   }
   .ipt{
     border:none;
     outline:none;
     width:100%;
     font-size:16px;
   }
   .select {
	    padding-top:5px;
	    padding-bottom:5px;
		border: 0;
		appearance:none;
		background: #fff;
		color: #000;
		outline: medium none;
		width:100%;
		height:100%;
		font-size: 16px;
	}
   
   .userBnos{
        width: 100%;
        background: #fff;
        z-index: 9999;
        position: absolute;
        border:1px solid #ABABAB;
        display: none;
   }
   
   .userBno{
        width:100%;
        padding-left: 30%;
        padding-top: 4px;
        padding-bottom: 4px;
   }
   
   body {
    overflow-x:hidden;
    margin: 0;
   }
   html {
    overflow-x:hidden;
   }
   
label {cursor:pointer;height:40px;}
label i {font-size:18px;font-style:normal;display:inline-block;width:18px;height:18px;text-align:center;line-height:18px;color:#fff;vertical-align:middle;margin:-2px 2px 1px 0px;border:#2489c5 1px solid;}
input[type="checkbox"] {display:none;}
input[type="checkbox"]:checked + i {background:#2489c5;}
input[type="checkbox"]:disabled + i {border-color:#ccc;}
input[type="checkbox"]:checked:disabled + i {background:#ccc;}

  </style>

</head>

<body style="background:url(../../image/bj.png) repeat-x 0;background-size:100%;">
<div style="background:url(../../image/mainbg.png) no-repeat right 0 bottom 0%;">
<div>
       <header id="statusBar">
		<div style="width:100%;display:table;background: #fff;position:fixed;border-bottom:1px solid #EAEAEA;z-index: 9999;height: 50px;" >
			<div style="float:left;width: 20%;height: 50px;line-height: 50px;" tapmode="presshover" onclick="api.closeWin();">
			  <div style="float:left;width: 30%;height: 50px;">
			   <img style="width: 24px;margin-top: 13px;" src="../../image/blc_back.png" />
			   </div>
			   <div style="float:left;width: 50%;">
			   返回
			   </div>
			</div>
			<div style="float:left;width: 60%;height: 50px;line-height: 50px;text-align: center;font-weight:bold;">
			 添加店铺
			</div>
		</div>
	 </header>
          <div style="height:70px"></div>
          <div class='odiv'>  
          <div class='idiv'>店铺名称</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="storeName" placeholder="请输入店铺名称"/>
          </div>
          </div>
          <div class='odiv'>  
          <div class='idiv'>店铺地址</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="storeAddr" placeholder="请输入店铺地址"/>
          </div> 
          </div>
          <div class='odiv'>  
          <div class='idiv'>商户类型</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="businessType" tapmode="presshover" readonly="true" placeholder="请选择商户类型" onclick="selBusinessType();" />
          <input id="btcode" type="hidden"/>
          </div> 
          </div>
          <div class='odiv'>  
          <div class='idiv'>所在城市</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="city" placeholder="请选择所在城市" tapmode="presshover" readonly="true" onclick="selCity();"/>
          <input id="ctcode" type="hidden"/>
          </div> 
          </div>
          
          <div style="height:10px"></div>
          
          <div class='odiv' tapmode="presshover">  
          <div class='idiv'>账户类型</div>
          <div class="div_text" style="margin-right:20px;">
	          <select class="select" onchange="accountType();" id="accountType">
			      <option selected value="1">个人账户</option>
			      <option value="2">对公账户</option>
			   </select>
          </div> 
          </div>
          <div class='odiv' id="company" style="display:none">  
          <div class='idiv'>户名</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="companyName" placeholder="请输入公司全称"/>
          </div> 
          </div>
          
          <div style="height:10px"></div>
          <div class='odiv'>  
          <div class='idiv' id="bankCard">银行卡号</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="cardNo" placeholder="请输入卡号（非信用卡）" onBlur="hideBno();" onFocus="showBno();"/>
          <input  type="hidden" id="cid"/>
          </div> 
          </div>
          
          <div id="userBankNo" class="userBnos">
          </div>
          
          <div class='odiv'>  
          <div class='idiv'>持卡人姓名</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="name" placeholder="请输入姓名"/>
          </div> 
          </div>
          
          <div class='odiv'>  
          <div class='idiv'>身份证号</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="idCard" placeholder="请输入身份证号码"/>
          </div> 
          </div>
          
          <div class='odiv'>  
          <div class='idiv'>手机号</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="telephone" placeholder="请输入手机号码"/>
          </div> 
          </div>
          
          <div class='odiv'>  
          <div class='idiv'>手机验证码</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" style="border:none;outline:none;width:50%;font-size:16px;" id="code" placeholder="请输入验证码"/>
          <input  type="button" style="border:none;outline:none;width:50%;background: #fff;" tapmode="presshover" onclick="getCode(this)" value="获取验证码"/>
          </div> 
          </div>
          <div style="height:10px"></div>
          
          <div class='odiv'>  
          <div class='idiv'>拓展机构</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="expanding" tapmode="presshover" readonly="true" placeholder="请选择拓展机构" onclick="selectExp();"/>
          <input id="expandingid" type="hidden">
          </div> 
          </div>
          
          <div class='odiv' id="bank" style="">  
          <div class='idiv'>发卡行行号</div>
          <div class="div_text" style="margin-right:20px;">
          <input  type="text" class="ipt" id="bankNo" placeholder="请致电发卡行热线咨询（非必填）"/>
          </div> 
          </div>
          
          <div style="margin-top: 10px;margin-left:10px;">
          <div style="float: left;">
            <label class="twinkle" tapmode="presshover"><input type="checkbox" id='read' value="0"/><i style="color:#EAEAEA">✓</i></label>
          </div>
          <div>
          我已认真<a href="" style="text-decoration: none" onclick="userAgreement();">阅读此协议</a>
          </div>
          </div>
          <div style="padding: 20px 0;width:100%;text-align: center;margin-top: 20px;" onclick="addStore();" tapmode="presshover">
			<div style="width:80%;height:35px;background: #27a8fa;margin:0 auto;color:#fff;line-height: 35px;border-radius:5px;">确认添加</div>
		  </div>
</div>
			
</div>		

<script>
    var countdown=60;
    var smsId = '';
	apiready = function(){
	   api.parseTapmode();
	   if(api.systemType == "ios"){
           document.getElementById("statusBar").style.background = "#298cb4";
        }
	   $api.fixStatusBar( $api.dom('header') );
	   $("#ctcode").val("6510");
	   $("#city").val("四川省-成都市");
	   $("#expanding").val("成都市");
	   $("#expandingid").val("3420");
       var phone = $api.getStorage("dl_phone");
       var callback = function(ret, err){
	        if(ret){
	            if(ret.success == true){
	              var list = ret.list;
	              var html = "";
	              for(var i=0;i<list.length;i++){
	                   if(list[i].DEFAULTCARD == "1"){
	                       $("#name").val(list[i].NAME);
	                       $("#idCard").val(list[i].IDNO);
	                   }
	                   if(typeof(list[i].CARDNO) != "undefined"){
	                       html += "<div class=\"userBno\" onclick=\"selectBankCardNo(\'"+list[i].CARDNO+"\',\'"+list[i].VOUCHER+"\');\">"+list[i].CARDNO+"</div>";
                       }
                  }
                  $("#userBankNo").html(html);
	            }
	        }else{
	            api.alert({msg: JSON.stringify(err)});
	        }
	   }
	   var content = {"phone":phone};
	   apiAjax(JSON.stringify(content),url.queryUserinfo,callback);
	}
	
	function selBusinessType(){
	    var UIActionSelector = api.require('UIActionSelector');
		UIActionSelector.open({
		    datas: businesstypes,
		layout: {
		        row: 5,
		        col: 2,
		        height: 40,
		        size: 12,
		        sizeActive: 14,
		        rowSpacing: 5,
		        colSpacing: 10,
		        maskBg: 'rgba(0,0,0,0.2)',
		        bg: '#fff',
		        color: '#888',
		        colorActive: '#27a8fa',
		        colorSelected: '#27a8fa'
		    },
		    animation: true,
		    cancel: {
		        text: '取消',
		        size: 12,
		        w: 90,
		        h: 35,
		        bg: '#fff',
		        bgActive: '#ccc',
		        color: '#888',
		        colorActive: '#fff'
		    },
		    ok: {
		        text: '确定',
		        size: 12,
		        w: 90,
		        h: 35,
		        bg: '#fff',
		        bgActive: '#ccc',
		        color: '#888',
		        colorActive: '#fff'
		    },
		    title: {
		        text: '请选择',
		        size: 12,
		        h: 44,
		        bg: '#eee',
		        color: '#888'
		    },
		    fixedOn: api.frameName
		}, function(ret, err) {
		    if (ret) {
		        //console.log(JSON.stringify(ret));
		        if("ok" == ret.eventType){
		           $("#btcode").val(ret.selectedInfo[1].code);
		           $("#businessType").val(ret.level1+"-"+ret.selectedInfo[1].name);
		        }
		    } else {
		        alert(JSON.stringify(err));
		    }
		});
	}
	
	function selCity(){
	    var UIActionSelector = api.require('UIActionSelector');
		UIActionSelector.open({
		    actives: [22,0,0],
		    datas: citys,
		layout: {
		        row: 5,
		        col: 2,
		        height: 40,
		        size: 12,
		        sizeActive: 14,
		        rowSpacing: 5,
		        colSpacing: 10,
		        maskBg: 'rgba(0,0,0,0.2)',
		        bg: '#fff',
		        color: '#888',
		        colorActive: '#27a8fa',
		        colorSelected: '#27a8fa'
		    },
		    animation: true,
		    cancel: {
		        text: '取消',
		        size: 12,
		        w: 90,
		        h: 35,
		        bg: '#fff',
		        bgActive: '#ccc',
		        color: '#888',
		        colorActive: '#fff'
		    },
		    ok: {
		        text: '确定',
		        size: 12,
		        w: 90,
		        h: 35,
		        bg: '#fff',
		        bgActive: '#ccc',
		        color: '#888',
		        colorActive: '#fff'
		    },
		    title: {
		        text: '请选择',
		        size: 12,
		        h: 44,
		        bg: '#eee',
		        color: '#888'
		    },
		    fixedOn: api.frameName
		}, function(ret, err) {
		    if (ret) {
		        //console.log(JSON.stringify(ret));
		        if("ok" == ret.eventType){
		           $("#ctcode").val(ret.selectedInfo[1].code);
		           $("#city").val(ret.level1+"-"+ret.selectedInfo[1].name);
		           if(ret.level1 == "四川省"){
		              $("#expanding").val(ret.selectedInfo[1].name);
	                  $("#expandingid").val(ret.selectedInfo[1].num);
		           }else{
		              $("#expanding").val("四川航天信息有限公司");
	                  $("#expandingid").val("349");
		           }
		        }
		    } else {
		        alert(JSON.stringify(err));
		    }
		});
	}
	
	function showBno(){
	     $("#userBankNo").show();
	}
	
	function hideBno(){
	   setTimeout(function(){
         $("#userBankNo").hide();
       },120);
    }
    
    function userAgreement(){
       api.openWin({
	       name: 'userAgreement',
	       url: 'userAgreement.html'
       });
    }
    
    function selectBankCardNo(no,cid){
         $("#cardNo").val(no);
         $("#cid").val(cid);
    }
	
	function getCode(el){
	   var phone = $("#telephone").val();
	   if(!isPhoneno(phone)){
	        api.alert({msg: "请输入正确的手机号"});
	        return;
	   }
	   settime(el);
	   var callback = function(ret, err){
	        if(ret.success == true){
	           smsId = ret.smsId;
	        }
	   }
	   var content = {"phone":phone};
	   apiAjax(JSON.stringify(content),url.sendSms,callback);

	}
	
	$("#read").change(function(){  
	  if($("input[id='read']").is(':checked') == true){
        
      }
	});
	
	function check(storeName,storeAddr,accType,cardNo,name,idCard,telephone,code,companyName,bankNo,btcode,ctcode,expanding){
	   var flag = true;
	   if(storeName == ""){
	      api.alert({msg: "店铺名称输入有误！"});
	      flag = false;
	      return;
	   }
	   if(storeName.length > 12){
	      api.alert({msg: "店铺名称长度过长，请重新输入！"});
	      flag = false;
	      return;
	   }
	   if(storeAddr.length > 100){
	      api.alert({msg: "店铺地址长度过长，请重新输入！"});
	      flag = false;
	      return;
	   }
	   if(storeAddr == ""){
	      api.alert({msg: "店铺地址输入有误！"});
	      flag = false;
	      return;
	   }
	   if(cardNo == ""){//|| !luhmCheck(cardNo)
	      api.alert({msg: "银行卡号输入有误！"});
	      flag = false;
	      return;
	   }
	   if(name == ""){
	      api.alert({msg: "姓名输入有误！"});
	      flag = false;
	      return;
	   }
	   if(btcode == ""){
	      api.alert({msg: "请选择商户类型！"});
	      flag = false;
	      return;
	   }
	   if(ctcode == ""){
	      api.alert({msg: "请选择所在城市！"});
	      flag = false;
	      return;
	   }
	   if(expanding == ""){
	      api.alert({msg: "请填写拓展机构编码！"});
	      flag = false;
	      return;
	   }
	   if(idCard == "" || !isIdcard(idCard)){
	      api.alert({msg: "身份证号输入有误！"});
	      flag = false;
	      return;
	   }
	   if(telephone == "" || !isPhoneno(telephone)){
	      api.alert({msg: "手机号输入有误！"});
	      flag = false;
	      return;
	   }
	   if(code == ""){
	      api.alert({msg: "验证码输入有误！"});
	      flag = false;
	      return;
	   }
	   if($("input[id='read']").is(':checked') == false){
	      api.alert({msg: "请确认阅读相关协议！"});
	      flag = false;
	      return;
	   }
	   if(accType == "2"){
		   if(companyName == ""){
		      api.alert({msg: "户名输入有误！"});
		      flag = false;
		      return;
		   }
		   if(bankNo == ""){
		      api.alert({msg: "发卡行行号输入有误！"});
		      flag = false;
		      return;
		   }
	   }
	   return flag;	   
	}
	
	function addStore(){
	   var bdid = $api.getStorage("loginid");
	   var dlphone = $api.getStorage("dl_phone");
	   var storeName = $("#storeName").val();
	   var storeAddr = $("#storeAddr").val();
	   var accType = $("#accountType").val();
	   var cardNo = $("#cardNo").val();
	   var name = $("#name").val();
	   var idCard = $("#idCard").val();
	   var telephone = $("#telephone").val();
	   var code = $("#code").val();
	   var expanding = $("#expandingid").val();
	   var cid = $("#cid").val();
	   var btcode = $("#btcode").val();
	   var ctcode = $("#ctcode").val();
	   var companyName = '';
	   var bankNo = '';
	   if(accType == "2"){
	     companyName = $("#companyName").val();
	     bankNo = $("#bankNo").val();
	   }else{
	     bankNo = $("#bankNo").val();
	   }
	   if(!check(storeName,storeAddr,accType,cardNo,name,idCard,telephone,code,companyName,bankNo,btcode,ctcode,expanding)){
	       return;
	   }
	   var uiId;
       var UILoading = api.require('UILoading');
		UILoading.flower({
		    center: {
		        x: api.winWidth/2.0,          
		        y: api.winHeight/2.0 
		    },
		    size: 30,
		    mask: "rgba(0,0,0,0.5)",
		    fixed: true
		}, function(ret) {
		    uiId = ret.id;
	    });
	   var callback = function(ret, err){
	        //console.log(JSON.stringify(ret));
	        UILoading.closeFlower({
			    id: uiId
			});
	        if(ret){
		        if(ret.success == true){
		           api.alert({msg: "添加成功"});
		           api.sendEvent({
		                name:'addStore'
	               });
	               api.closeWin();
		        }else{
		           api.alert({msg: "添加失败，原因："+ret.msg});
		        }
	        }else{
	           api.alert({msg: "添加失败，原因："+JSON.stringify(err)});
	        }
	   }
	   var content = {"accNo":cardNo,"phone":telephone,"merName":storeName,"merAddr":storeAddr,"accType":accType,"cusName":name,"certNo":idCard,"expPeople":expanding,"accName":companyName,"bankNo":bankNo,
	   "certType":"01","merid":"","bindId":bdid,"code":code,"dlphone":dlphone,"smsId":smsId,"cid":cid,"btcode":btcode,"ctcode":ctcode};
	   apiAjax(JSON.stringify(content),url.addStore,callback);
	}
	
	function selectExp(){
       var UIMultiSelector = api.require('UIMultiSelector');
		 UIMultiSelector.open({
		     rect: {
		         h: 295
		     },
		     text: {
		         title: '拓展机构',
		         leftBtn: '取消',
		         rightBtn: '确认',
		         selectAll: 'ALL'
		     },
		     max: 0,
		     singleSelection: true,
		     styles: {
		         bg: '#fff',      
		         mask: 'rgba(0,0,0,0.5)',
		         title: {
		             bg: '#fff',
		             color: '#27a8fa',
		             size: 16,
		             h: 44
		         },
		         leftButton: {
		             bg: '#fff',    
		             w: 80,
		             h: 35,
		             marginT: 5,
		             marginL: 8,
		             color: '#FF6347',
		             size: 14
		         },
		         rightButton: {
		             bg: '#fff',    
		             w: 80,
		             h: 35,
		             marginT: 5,
		             marginR: 8,
		             color: '#32CD32',
		             size: 14
		         },
		         item: {
		             h: 50,
		             bg: '#FAFAFA',
		             bgActive: '#27a8fa',
		             bgHighlight: '#27a8fa',
		             color: '#8d8d8d',
		             active: '#fff',
		             highlight: '#fff',
		             size: 16,
		             lineColor: '#EBEBEB',
		             textAlign: 'center'
		         },
			     icon: {                            //（可选项）JSON 类型；每个选项的状态图标样式，若不传则不显示选中的状态图标
			        w: 0,                         //（可选项）数字类型；图标的高度；默认：20
			        h: 0,                         //（可选项）数字类型；图标的高度；默认：w
			        marginT: 11,                   //（可选项）数字类型；图标的上边距；默认：(item.h - h) / 2
			        marginH: 8,                    //（可选项）数字类型；图标的横向边距，与 align 的对齐方向相关；默认：8
			        bg: '#fff',                    //（可选项）字符串类型；图标未选中时的背景，支持 rgb、rgba、#、img；默认：rgba(0,0,0,0)
			        bgActive: '#fff',              //（可选项）字符串类型；已选中图标的背景，支持 rgb、rgba、#、img；默认：bg
			        bgHighlight: '#fff',           //（可选项）字符串类型；选项的高亮背景，支持 rgb、rgba、#、img；默认：bg
			        align: 'left'                  //（可选项）字符串类型；图标相对与选项的对齐方式：'left|right'；默认：left
			     }
		     },
		     animation: true,
		     items:  organization
		 }, function(ret, err) {
		     //console.log(JSON.stringify(ret));
		     if (ret) {
		         if(ret.eventType == "clickLeft"){
		            UIMultiSelector.hide();
		         }else if(ret.eventType == "clickRight"){
		            $("#expanding").val(ret.items[0].text);
		            $("#expandingid").val(ret.items[0].id);
		            UIMultiSelector.hide();
		         }
		     } else {
		         alert(JSON.stringify(err));
		     }
		 });
    }
	
	function accountType(){
	  if($("#accountType").val() == "1"){
	    $("#company").hide();
	    //$("#bank").hide();
	    document.getElementById("cardNo").setAttribute("placeholder","请输入卡号（非信用卡）");
	    $("#bankCard").html("银行卡号");
	  }else{
	    $("#company").show();
	    //$("#bank").show();
	    document.getElementById("cardNo").setAttribute("placeholder","请输入对公银行账号");
	    $("#bankCard").html("收款账号");
	  }
	}
	
	function settime(val) {
      if (countdown == 0) {
        val.removeAttribute("disabled");
        val.value="获取验证码";
        countdown = 60;
        $("#yzm").val("");
        window.clearTimeout(timer);
      } else {
        val.setAttribute("disabled", true);
        val.value= countdown + "s";
        countdown--;
        timer = setTimeout(function() {
          settime(val);
        },1000);
      }
    }
    
    //判断手机号
    function isPhoneno(phone){
        var phoneReg = /(^1[2|3|4|5|6|7|8]\d{9}$)|(^09\d{8}$)/;  
		if (!phoneReg.test(phone)) {   
		    return false;  
		}else{
		    return true;
		}  
    }
    
    //判断身份证号
    function isIdcard(idNo){
	    var regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
	    if(!regIdNo.test(idNo)){  
	        return false;  
	    }else{
	        return true;
	    } 
    } 

    
    //luhn校验银行卡号
    function luhmCheck(bankno) {
	    var lastNum = bankno.substr(bankno.length - 1, 1); //取出最后一位（与luhm进行比较）
	    var first15Num = bankno.substr(0, bankno.length - 1); //前15或18位
	    var newArr = new Array();
	    for (var i = first15Num.length - 1; i > -1; i--) { //前15或18位倒序存进数组
	        newArr.push(first15Num.substr(i, 1));
	    }
	    var arrJiShu = new Array(); //奇数位*2的积 <9
	    var arrJiShu2 = new Array(); //奇数位*2的积 >9
	    var arrOuShu = new Array(); //偶数位数组
	    for (var j = 0; j < newArr.length; j++) {
	        if ((j + 1) % 2 == 1) { //奇数位
	            if (parseInt(newArr[j]) * 2 < 9) arrJiShu.push(parseInt(newArr[j]) * 2);
	            else arrJiShu2.push(parseInt(newArr[j]) * 2);
	        } else //偶数位
	        arrOuShu.push(newArr[j]);
	    }
	 
	    var jishu_child1 = new Array(); //奇数位*2 >9 的分割之后的数组个位数
	    var jishu_child2 = new Array(); //奇数位*2 >9 的分割之后的数组十位数
	    for (var h = 0; h < arrJiShu2.length; h++) {
	        jishu_child1.push(parseInt(arrJiShu2[h]) % 10);
	        jishu_child2.push(parseInt(arrJiShu2[h]) / 10);
	    }
	 
	    var sumJiShu = 0; //奇数位*2 < 9 的数组之和
	    var sumOuShu = 0; //偶数位数组之和
	    var sumJiShuChild1 = 0; //奇数位*2 >9 的分割之后的数组个位数之和
	    var sumJiShuChild2 = 0; //奇数位*2 >9 的分割之后的数组十位数之和
	    var sumTotal = 0;
	    for (var m = 0; m < arrJiShu.length; m++) {
	        sumJiShu = sumJiShu + parseInt(arrJiShu[m]);
	    }
	 
	    for (var n = 0; n < arrOuShu.length; n++) {
	        sumOuShu = sumOuShu + parseInt(arrOuShu[n]);
	    }
	 
	    for (var p = 0; p < jishu_child1.length; p++) {
	        sumJiShuChild1 = sumJiShuChild1 + parseInt(jishu_child1[p]);
	        sumJiShuChild2 = sumJiShuChild2 + parseInt(jishu_child2[p]);
	    }
	    //计算总和
	    sumTotal = parseInt(sumJiShu) + parseInt(sumOuShu) + parseInt(sumJiShuChild1) + parseInt(sumJiShuChild2);
	 
	    //计算Luhm值
	    var k = parseInt(sumTotal) % 10 == 0 ? 10 : parseInt(sumTotal) % 10;
	    var luhm = 10 - k;
	 
	    if (lastNum == luhm) {
	        return true;
	    } else {
	        return false;
	    }
    }
</script>



</body></html>
